import unittest as ut
import config
import View
import time

class ConfigTestCase(ut.TestCase):
    def setUp(self):
        self.cfg = config.CConfig()

    def test_infinitiUpdateFromFile(self):
        self.cfg.UpdateFromFile("D:/Work/Project/Release/release_script_py/UT_Resource/configInfiniti.xml")
        self.assertEqual(self.cfg.sgold_ver_high, "13")
        self.assertEqual(self.cfg.sgold_ver_low, "11")
        self.assertEqual(self.cfg.sgold_ver_type, "I")
        self.assertEqual(self.cfg.sgold_ver_svn, "00.00:03.01:00.00")
        self.assertEqual(self.cfg.s12_ver_id, "0.2.5_20120301")
        self.assertEqual(self.cfg.viewHome, r"D:\Work\View\Zengj_view\Zengj_Infiniti_test")

class ViewTestCase(ut.TestCase):
    def setUp(self):
        self.view = View.CDcmView(r"D:\Work\View\Zengj_view\Zengj_Infiniti_test")
        self.cfg = config.CConfig()
        self.view.SetConfig(self.cfg)

    def test_update(self):
        #self.view.UpdateAll()
        pass

    def test_generatecode(self):
        #self.view.GenerateCode()
        pass

    def test_changeVersion(self):
        #self.view.UpdateVersionFile()
        pass

    def test_changeScript(self):
        #self.view.ChangeCleanScript()
        #self.view.ChangeBuildScript()
        pass

    def test_compile(self):
        #self.view.CompileSgold()
        pass
    def test_getRelDir(self):
        #dirPath = self.view.GetReleaseDir()
        #self.assertEqual(dirPath, r"Nissan_DCM\release\NISSAN_NONE_DCM_00.00D\NISSAN_NONE_DCM_0000D_%s" % time.strftime('%Y%m%d'))
        pass

    def test_moveImage(self):
        #self.view.MoveSgoldImage()
        pass


if __name__ == "__main__":
    runner = ut.TextTestRunner()
    suite = ut.TestSuite()

    configSuite = ut.TestLoader().loadTestsFromTestCase(ConfigTestCase)
    suite.addTest(configSuite)

    viewSuite = ut.TestLoader().loadTestsFromTestCase(ViewTestCase)
    suite.addTest(viewSuite)

    runner.run(suite)
